﻿
@{
    Layout = null;
}

<html>
<head>
    <environment include="Development">
        <link href="~/layui/css/layui.css" rel="stylesheet" />
        <link href="~/css/login.css" rel="stylesheet" />
    </environment>
</head>
<body style="background:url(../images/login-bg.jpg) no-repeat; height:auto">
    <div class="video_mask"></div>
    <div class="login">
        <h1>管理登录</h1>
        <form class="layui-form" asp-action="CheckLogin" data-ajax-success="ajaxLogin.success" data-ajax-begin="ajaxLogin.checkSubmit"
              data-ajax-failure="ajaxLogin.failure" data-ajax="true" data-ajax-method="POST">
            <div class="layui-form-item">
                <input class="layui-input" name="username" placeholder="用户名" lay-verify="required" type="text" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <input class="layui-input" name="password" placeholder="密码" lay-verify="required" type="password" autocomplete="off">
            </div>
            <div class="layui-form-item form_code">
                <input class="layui-input" name="code" placeholder="验证码" lay-verify="required" type="text" autocomplete="off">
                <div class="code"><img src="/Login/MixVerifyCode" alt="vcode" onclick="this.src=this.src+'?'" style="cursor:pointer;" width="116" height="36"></div>
            </div>
            <button class="layui-btn login_btn" id="bt_login" type="submit" lay-filter="login">登录</button>
        </form>
    </div>
    <environment include="Development">
        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/layer/layer.js"></script>
        <script src="~/js/jquery.unobtrusive-ajax.min.js"></script>
    </environment>
    <script>
        window.ajaxLogin = new function () {
            var me = this;
            me.success = function (data) {
                console.log(data.msg)
                if (data.success) {
                    window.location.href = data.data.url;
                } else {
                    $("#bt_login").text("登录");
                    layer.alert(data.msg);
                    $("#bt_login").removeAttr("disabled");
                }
            };
            me.failure = function () {
                layer.alert("登录失败,请稍后再试!");
                $("#bt_login").text("登录");
                $("#bt_login").removeAttr("disabled");
            };
            me.checkSubmit = function () {
                $("#bt_login").attr("disabled", "disabled");
                $("#bt_login").text("登录中...");
            }
        }
    </script>
</body>
</html>







